package com.bt.lms.dao.servise.impl;

import com.bt.lms.entity.EmploymentInfo;
import com.bt.lms.dao.servise.StuEmploymentInfoDao;
import com.bt.lms.utils.DriverUtils;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.time.LocalDate;

/**
 * 就业信息
 */
public class StuEmploymentInfoDaoImpl implements StuEmploymentInfoDao {

    @Override
    public boolean update(String sql, EmploymentInfo employmentInfo,Long id) throws SQLException {
        String firmName = employmentInfo.getFirmName();
        String firmSite = employmentInfo.getFirmSite();
        LocalDate protocolSignedDate = employmentInfo.getProtocolSignedDate();
        LocalDate registerDate = employmentInfo.getRegisterDate();
        Integer firmType = employmentInfo.getFirmType();
        String firmDescribe = employmentInfo.getFirmDescribe();

        Connection conn = DriverUtils.Driver();
        PreparedStatement ps = conn.prepareStatement(sql);
        ps.setString(1,firmName);
        ps.setString(2,firmSite);
        ps.setString(3, String.valueOf(protocolSignedDate));
        ps.setString(4, String.valueOf(registerDate));
        ps.setInt(5,firmType);
        ps.setString(6,firmDescribe);
        ps.setLong(7,id);

        int i = ps.executeUpdate();

        //关闭资源
        ps.close();
        conn.close();
        return false;
    }
}
